package com.itheima.udpgaungbo;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class SendClient {
    public static void main(String[] args) throws IOException {
        //创建对象   发送对象
        DatagramSocket ds = new DatagramSocket();
        String  s="你瞅啥";
        //ip 广播地址  255.255.255.255
        InetAddress ip = InetAddress.getByName("255.255.255.255");
        int port=10010;
        //创建数据对象
        DatagramPacket dp = new DatagramPacket(s.getBytes(),s.getBytes().length,ip,port);
        //发送数据   数据
        ds.send(dp);

        //释放资源
        ds.close();
    }
}
